# Contributor: Carlo Bramini <carlo_bramini@users.sourceforge.net>

_realname=liblo
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.32
pkgrel=1
pkgdesc="An implementation of the Open Sound Control protocol"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://liblo.sourceforge.net/"
license=('spdx:LGPL-2.1-or-later')
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-autotools")
source=("https://downloads.sourceforge.net/${_realname}/${_realname}-${pkgver}.tar.gz"
        010-lld.patch)
sha256sums=('5df05f2a0395fc5ac90f6b538b8c82bb21941406fd1a70a765c7336a47d70208'
            'ec080eb239f3aa436a78190586ddadab844e3c1599e4bc69c1f623c50e7675b8')

prepare() {
  cd "${srcdir}/${_realname}-${pkgver}"
  patch -Np1 -i "${srcdir}/010-lld.patch"
}

build() {
  mkdir -p "build-${MSYSTEM}" && cd "build-${MSYSTEM}"

  export lt_cv_deplibs_check_method='pass_all'

  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --enable-shared

  make
}

package() {
  cd "build-${MSYSTEM}"
  make DESTDIR="${pkgdir}" install
}
